# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: trya <tryagainprod@gmail.com>

pkgbase=quazip
pkgname=(quazip-qt5 quazip-qt6)
pkgver=1.4
pkgrel=1
pkgdesc='C++ wrapper for the ZIP/UNZIP C package'
url='https://stachenov.github.io/quazip/'
license=(LGPL)
arch=(x86_64)
makedepends=(cmake qt5-base qt6-5compat)
source=(https://github.com/stachenov/$pkgbase/archive/v$pkgver/$pkgbase-$pkgver.tar.gz)
sha256sums=('79633fd3a18e2d11a7d5c40c4c79c1786ba0c74b59ad752e8429746fe1781dd6')

build() {
  cmake -B build5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build5

  cmake -B build6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQUAZIP_QT_MAJOR_VERSION=6
  cmake --build build6
}

package_quazip-qt5() {
  depends=(qt5-base)
  provides=(quazip)
  replaces=(quazip)

  DESTDIR="$pkgdir" cmake --install build5
}

package_quazip-qt6() {
  depends=(qt6-5compat)

  DESTDIR="$pkgdir" cmake --install build6
}
